导包
'''import unittest
02
from api.login import LoginAPI
f3.+3
?0.rom api.staff import StaffAPI
import config
# from common.dbutils import DBUtil


# 创建测试类
class TestStaffAPI(unittest.TestCase):
    TOKEN = None
    Staff_id = None

    # 类前置处理
    @classmethod
    def setUpClass(cls) -> None:
        # 实例化类（登录、员工管理）
        cls.login_api = LoginAPI()
        cls.staff_api = StaffAPI()

        # 登录成功
        response = cls.login_api.longin(config.login_data)
        print(response.json())

        # 提取登录成功之后data的数据并保存至属性TOKEN中
        TestStaffAPI.TOKEN = response.json().get("data")
        print(TestStaffAPI.TOKEN)

        # 删除测试数据
        # DBUtil.exe_sql("DELETE from bs_user where mobile = '13212120002';")

    # 类后置处理
    @classmethod
    def tearDownClass(cls) -> None:
        # # 删除测试数据
        # DBUtil.exe_sql("DELETE from bs_user where mobile = '13212120002';")
        pass

    # 业务场景：登录成功==》添加员工成功==>员工查询==》员工修改==》员工删除
    # 员工添加
    def test01_insert_staff(self):
        add_data = {
            "username":"jack0709t2",
            "mobile":"13272120002",
            "timeOfEntry":"2020-07-09",
            "formOfEmployment":1,
            "workNumber":"10086",
            "departmentName":"销售",
            "departmentId":"1266699057968001024",
            "correctionTime":"2020-07-30T16:00:00.000Z"
        }
        response = self.staff_api.insert_staff(add_data, TestStaffAPI.TOKEN)
        print(response.json())
        # 提取员工id并且保存至属性
        TestStaffAPI.Staff_id = response.json().get("data").get("id")
        print(TestStaffAPI.Staff_id)
        

    # 员工查询
    def test02_select_staff(self):
        response = self.staff_api.select_staff(TestStaffAPI.Staff_id, TestStaffAPI.TOKEN)
        print(response.json())

    # 员工修改
    def test03_update_staff(self):
        update_data = {"username": "rose666"}
        response = self.staff_api.update_staff(TestStaffAPI.Staff_id, update_data, TestStaffAPI.TOKEN)
        print(response.json())

    # 员工删除
    def test04_delete_staff(self):
        response = self.staff_api.delete_staff(TestStaffAPI.Staff_id, TestStaffAPI.TOKEN)
        print(response.json())'''
